<%@ page import="com.zl.customer.pojo.Customer" %>
<%@ page import="java.util.List" %>
<%@ page language="java" contentType="text/html;charset=UTF-8" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>客户列表</title>

<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="expires" content="0">
<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
<meta http-equiv="description" content="This is my page">
<!--
	<link rel="stylesheet" type="text/css" href="styles.css">
	-->
<style type="text/css">
	.curr{
		background-color: blue;
		padding:5px;
		color:#FFF;
		font-size:14px;
		
	}
</style>
	<%--<script type="text/javascript" src="${pageContext.request.contextPath }/jquery/jquery.js"></script>--%>
	<%--<script type="text/javascript" src="<%=request.getContextPath() %>/jquery/jquery.js"></script>--%>
	<script type="text/javascript" src="<c:url value="/jquery/jquery.js"/>"></script>
</head>

<body>
	<h3 align="center">客户列表</h3>
	<table border="1" width="70%" align="center">
		<tr>
			<th>客户姓名</th>
			<th>性别</th>
			<th>生日</th>
			<th>手机</th>
			<th>邮箱</th>
			<th>描述</th>
			<th>操作</th>
		</tr>
		<tbody>
            <%--<%--%>
                <%--//从request域获取数据--%>
                <%--List<Customer>  list = (List<Customer>)request.getAttribute("customers");--%>
                <%--//遍历集合--%>
                <%--for (Customer c : list) {--%>
            <%--%>--%>
                 <%--<tr>--%>
                     <%--<td><%=c.getCname() %></td>--%>
                     <%--<td><%=c.getSex() %></td>--%>
                     <%--<td><%=c.getBrithday() %></td>--%>
                     <%--<td><%=c.getCellphone() %></td>--%>
                     <%--<td><%=c.getEmail() %></td>--%>
                     <%--<td><%=c.getDescription() %></td>--%>
                     <%--<td>--%>
                         <%--<a href="">编辑</a>--%>
                         <%--<a href="">删除</a>--%>
                     <%--</td>--%>
                 <%--</tr>--%>
            <%--<%--%>
                <%--}--%>
            <%--%>--%>
		   <c:forEach items="${customers}" var="c" varStatus="vs">
			   <tr <c:if test="${vs.index % 2 == 0}"> style="background-color: #0a6397;" </c:if>>
				   <td>${c.cname}</td>
				   <td>${c.sex}</td>
				   <%--<td>${c.brithday}</td> --%> <!--yyyy年MM月dd日:  SimpleDateFormat-->
				   <td><fmt:formatDate value="${c.brithday}" pattern="yyyy年MM月dd日"/></td>
				   <td>${c.cellphone}</td>
				   <td>${c.email}</td>
				   <td>${c.description}</td>
				   <td>
				   <a href="${pageContext.request.contextPath}/queryCustomerById.action?cid=${c.cid}">编辑</a>
				   <a href="${pageContext.request.contextPath}/delCustomer.action?cid=${c.cid}">删除</a>
				   </td>
			   </tr>
		   </c:forEach>
		</tbody>

	</table>
	<script type="text/javascript">
			$("tfoot a").click(function(){
				//alert( $(this).attr("data"));	
				$("#pi").val($(this).attr("data"));
				//提交表单
				$("#queryForm").submit();
			});
			
	</script>
	<form id="queryForm" action="${pageContext.request.contextPath }/queryCustomer.action">
	   <input type="hidden"  id="pi" value="${pages.pageIndex }" name="pageIndex" />
	   <input type="hidden"  value="${condition.customer.cname }" name="cname" />
	   <input type="hidden"  value="${condition.customer.sex }" name="gender"/>
	   <input type="hidden"  value="${condition.customer.cellphone }" name="cellphone" />
	   <input type="hidden"  value="${condition.customer.email }" name="email"/>
	</form>
</body>
</html>
